﻿using Abp.Authorization;
using Abp.Authorization.Users;
using Abp.Notifications;
using Abp.Organizations;
using AutoMapper;
using Partner.Surround.Authorization.Permissions.Dto;
using Partner.Surround.Authorization.Roles;
using Partner.Surround.Authorization.Roles.Dto;
using Partner.Surround.Authorization.Users;
using Partner.Surround.Authorization.Users.Dto;
using Partner.Surround.Notifications.Dto;
using Partner.Surround.Organizations.Dto;

namespace Partner.Surround.Frame.DtoMapper
{
    /// <summary>
    /// 基础支撑平台映射
    /// </summary>
    internal static class FrameDtoMapper
    {
        public static void CreateMappings(IMapperConfigurationExpression configuration)
        {
            #region 组织机构
            configuration.CreateMap<OrganizationUnit, OrganizationUnitListDto>();
            configuration.CreateMap<OrganizationUnit, OrganizationUnitEditDto>().ReverseMap();
            #endregion

            #region 用户管理
            configuration.CreateMap<User, UserEditDto>().ReverseMap();
            configuration.CreateMap<User, UserListDto>();

            configuration.CreateMap<NotificationDefinition, NotificationSubscriptionWithDisplayNameDto>();
            configuration.CreateMap<UserRole, UserListRoleDto>();
            #endregion

            #region 角色管理
            configuration.CreateMap<Role, RoleListDto>();
            configuration.CreateMap<Role, RoleEditDto>().ReverseMap();
            #endregion

            #region 权限管理
            configuration.CreateMap<Permission, PermissionDto>();
            configuration.CreateMap<Permission, FlatPermissionDto>();
            configuration.CreateMap<Permission, FlatPermissionWithLevelDto>();
            #endregion
        }
    }
}
